<template>
	<view class="contain">
		<view class="title">
			尊敬的园长:
		</view>
		<view class="">
			<u--textarea :height='150' v-model.trim="content" placeholder="请输入内容" ></u--textarea>
		</view>
		<button class="btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import {save} from '@/api/opinionThin.js'
	export default {
		data(){
			return {
				content:''
			}
		},
		methods:{
			async submit(){
				if(!this.content.length){
					return this.$api.showTip('请输入内容')
				}
				const {	data }=await save({
					content:this.content,
					title:'尊敬的园长:',
					className:this.$util.getChild().className,
					classId:this.$util.getChild().classId,
					userPhone:this.$util.getUser().phone
				})
				if(data.code==0){
					this.$api.showTip('提交成功',()=>{
						uni.redirectTo({
							url:'list'
						})
					})
				}else{
					this.$api.showTip('提交失败')
				}
				console.log('返回结果',data)
			}
		}
	}
</script>

<style lang="scss">
	.contain{
		padding: 10px 20px;
		.title{
			margin-bottom: 10px;
			font-weight: 700;
		}
	}
</style>